local zhenxing = fk.CreateSkill {
  name = "tyj_heg__zhenxing",
}
local H = require "packages.ol_hegemony.util"
local U = require "packages.utility.utility"
Fk:loadTranslationTable{
      ["tyj_heg__zhenxing"]="镇行",
      [":tyj_heg__zhenxing"]="你受到伤害后，可以展示手牌并展示牌堆顶的至多三张牌，若与你手牌的中牌的花色均不同，你获得之。",
      ["$tyj_heg__zhenxing1"]="东征西讨，募军百里挑一。",
      ["$tyj_heg__zhenxing2"]="众口铄金，积毁销骨。",
    }
    zhenxing:addEffect(fk.Damaged,{
      can_trigger = function (self, event, target, player, data)
        return target==player and player:hasSkill(zhenxing.name)
      end,
      on_cost = function (self, event, target, player, data)
        local room = player.room
        local choices = {"1","2","3","Cancel"}
        local choice = room:askToChoice(player,{
                choices = choices,
                skill_name = zhenxing.name,
                prompt = "是否发动 镇行 展示牌堆顶的至多三张牌？",
              })
        if choice ~= "Cancel" then
          event:setCostData(self,{num = tonumber(choice)})
          return true
        end
      end,
      on_use = function (self, event, target, player, data)
        local room = player.room
        local getcards = room:getNCards(event:getCostData(self).num)
        player:showCards(getcards)
        room:delay(600)
        player:showCards(player:getCardIds('h'))
        room:delay(800)
        local suits = {}
        for _, cid in ipairs(player:getCardIds('h')) do
          local c = Fk:getCardById(cid)
          if c.suit then
            table.insertIfNeed(suits,c.suit)
          end
        end
        if #table.filter(getcards,function(cid)
        return table.contains(suits,Fk:getCardById(cid).suit) end)==0 then
          room:moveCardTo(getcards, Player.Hand, player, fk.ReasonPrey, zhenxing.name, nil, true)
        end
      local cards = table.filter(getcards, function(id) return room:getCardArea(id) == Card.Processing end)
        room:moveCardTo(cards, Card.DrawPile, nil, fk.ReasonPutIntoDiscardPile, self.name, nil, true, player)
      end,
    })
    return zhenxing